<?php
namespace app\api\controllers;

use yii\web\Controller;
use app\models\GkyWeGuestProf;
use app\api\Response;
use yii\helpers\ArrayHelper;
use yii\db\Query;
class GuestProfessorController extends Controller{
   public function actionGetProfessor($pageNow, $pageSize){
       Response::setHeader();
       echo json_encode(GkyWeGuestProf::getProfessor($pageNow, $pageSize));
   }
   public function actionSearch($coursename) {
        $lwnames=  GkyWeGuestProf::find()
              ->where(['or',['like','res_dir',$coursename],['like','name',$coursename]])
              ->all();
      Response::setHeader();
      return json_encode(\yii\helpers\ArrayHelper::toArray($lwnames));
    }
    
    public function actionDetail($id){

        $detail = GkyWeGuestProf::findOne(['id'=>$id]);
        Response::setHeader();
        echo json_encode(ArrayHelper::toArray($detail));
    }
}